package xjtu.se.articlecommunity.user.myself.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import xjtu.se.articlecommunity.user.home.dto.FeedDto;

import java.util.List;

public interface SubDao {
    @Select("select a_id,a_title,a_html,a_date,a.u_id,u_name,u_avatar,\n" +
            "(select count(1) from t_subscription where t_subscription.a_id=a.a_id) as sub_count,\n" +
            "(select count(1) from t_comment where t_comment.a_id=a.a_id) as com_count,\n" +
            "(select count(1) from t_article_like where t_article_like.a_id=a.a_id) as like_count \n" +
            "from t_article a,t_user u \n" +
            "where a.u_id=u.u_id and a.a_id and a_status=1 in (select s.a_id from t_article a,t_subscription s where a.a_id=s.a_id and s.u_id=#{u_id})")
    List<FeedDto> getSubList(@Param("u_id") String u_id);
}
